<template>
  <div class="app-container">
    <!-- <el-row style="text-align: right;margin-bottom: 15px"><el-button
      type="primary"
      icon="el-icon-plus"
      size="mini"
      @click="handleAdd"
    >添加</el-button></el-row> -->
      <el-row>
        <el-col :span="4">
          <div class="grid-content bg-purple" :style="'height:'+boxheight">
            <div class="above firstAbove"><div class="title">食谱分类</div></div>
            <div class="under first_under">
              <ul>
                <li v-for="(dict,index) in dict.type.cuisine_type" @click="changefoodSort(dict.value,dict.label)" :class="actived==dict.value?'chooseStyle':''">
                  {{dict.label}}
                </li>
              </ul>
            </div>
          </div>
        </el-col>
        <el-col :span="6" style="padding:0 10px">
          <div class="grid-content bg-purple" :style="'height:'+boxheight">
            <div class="above">
              <div class="title" style="width: 100%;position: relative;text-align: center;">食谱列表
                <el-link class="add-ingredient" type="primary" :underline="false" @click="handleAdd">新增</el-link>
              </div>
              <div>
                <el-input v-model="cuisineName" @input="getCuisineList()" clearable placeholder="请输入食谱">
                </el-input>
              </div>
            </div>
            <div class="second_under">
              <ul>
                <li v-for="(item,index) in foodList" >
                  <div class="left" @click="changefoodList(item.id,index,item)" :class="listactived==index?'chooseStyle':''">
                    {{item.name}}
                  </div>
                  <div v-if="item.type==1" class="right" @click="delfoodname(item.foodId)">
                    删除
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </el-col>
        <el-col :span="14">
          <div class="grid-content bg-purple"  v-show="formopen">
            <el-form ref="form" :model="form" :rules="rules" label-width="100px" >
              <div class="third_above">
                <div class="title">食谱信息</div>
                <div class="special_Input">
                  <el-form-item label="食谱图片：" prop="foodImage">
                    <imageUpload v-model="form.foodImage" :limit="1" />
                  </el-form-item>
                  <el-form-item label="名称：" prop="name">
                    <el-input
                      v-model="form.name"
                      size="small"
                    />
                  </el-form-item>
                  <el-form-item label="类别：" prop="classify">
                    <el-select v-model="form.classify" >
                      <el-option
                        v-for="dict in dict.type.cuisine_type"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                        size="small">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <!-- <el-form-item label="重量：" prop="weight">
                    <el-input v-model="form.weight" type="number">
                      <template slot="append">克（g）</template>
                    </el-input>
                  </el-form-item> -->
                </div>
              </div>
              <div class="third_center_table">
                <div class="head">食物组成：</div>
                <el-table :data="tableData" border>
                  <el-table-column
                    label="序号"
                    align="center"
                    type="index"
                    fixed
                    sortable
                  />

                  <el-table-column label="食材名称" prop="name" align="center">
                    <template slot-scope="scope">
                      <div class="flex align-center">
                        <el-input disabled v-model="scope.row.name" />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="分类" prop="parentId" align="center" width="200">
                    <template slot-scope="scope">
                      <div class="flex align-center">
                        <el-select v-model="scope.row.parentId" disabled>
                          <el-option
                            v-for="dict in dict.type.cuisine_type"
                            :key="dict.value"
                            :label="dict.label"
                            :value="parseInt(dict.value)"
                            size="small">
                          </el-option>
                        </el-select>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="用量（g/ml）" prop="phr" align="center">
                    <template slot-scope="scope">
                      <div class="flex align-center">
                        <el-input v-model="scope.row.phr" />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="能量（kcal）" prop="energy" align="center">
                    <template slot-scope="scope">
                      <div class="flex align-center">
                        <el-input v-model="scope.row.energy" disabled />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                      <el-button
                        type="text"
                        icon="el-icon-delete"
                        @click="delRow(scope.$index,scope.row)"
                      ></el-button>
                    </template>
                  </el-table-column>
                </el-table>
                <div style="display:flex;justify-content: center;margin-top:10px">
                  <el-button @click="addRow">添加食材</el-button>
                </div>
              </div>
              <div class="third_under" :style="'height:'+unheight">
                <div v-if="majorNutrientShow">
                  <div class="one_part">
                  <div class="head">主要营养：</div>
                  <div class="info">
                    <div class="each">
                      <el-form-item label="能量" prop="energy">
                        <el-input v-model="formattedEnergy" type="number" disabled/>
                      </el-form-item>
                      <div class="foot">千卡（Kcal）</div>
                    </div>
                    <div class="each">
                      <el-form-item label="脂肪" prop="fat">
                        <el-input v-model="formattedFat" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="蛋白质" prop="protein">
                        <el-input v-model="formattedProtein" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="膳食纤维" prop="fatFiber">
                        <el-input v-model="formattedFatFiber" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="碳水化合物" prop="carbohydrate">
                        <el-input v-model="formattedCarbohydrate" type="number" disabled/>
                      </el-form-item>
                      <div class="foot">千卡（Kcal）</div>
                    </div>
                  </div>
                </div>

                <div class="one_part">
                  <div class="head">维生素：</div>
                  <div class="info">
                    <div class="each">
                      <el-form-item label="维生素A" prop="vitaminA">
                        <el-input v-model="formattedVitaminA" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="胡萝卜素" prop="carotene">
                        <el-input v-model="formattedCarotene" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="维生素b1" prop="vitaminB1">
                        <el-input v-model="formattedVitaminB1" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="维生素b2" prop="vitaminB2">
                        <el-input v-model="formattedVitaminB2" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="维生素b3" prop="vitaminB3">
                        <el-input v-model="formattedVitaminB3" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="维生素c" prop="vitaminC">
                        <el-input v-model="formattedVitaminC" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="维生素e" prop="vitaminE">
                        <el-input v-model="form.vitaminE" type="number" disabled/>
                      </el-form-item>
                    </div>
                  </div>
                </div>

                <div class="one_part">
                  <div class="head">矿物质：</div>
                  <div class="info">
                    <div class="each">
                      <el-form-item label="钙" prop="ca">
                        <el-input v-model="formattedCa" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="镁" prop="mg">
                        <el-input v-model="formattedMg" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="铁" prop="fe">
                        <el-input v-model="formattedFe" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="锌" prop="zn">
                        <el-input v-model="formattedZn" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="硒" prop="se">
                        <el-input v-model="formattedSe" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="铜" prop="cu">
                        <el-input v-model="formattedCu" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="锰" prop="mn">
                        <el-input v-model="formattedMn" type="number" disabled/>
                      </el-form-item>
                    </div>
                    <div class="each">
                      <el-form-item label="碘" prop="i">
                        <el-input v-model="formattedI" type="number" disabled/>
                      </el-form-item>
                    </div>
                  </div>
                </div>
                </div>
                <div slot="footer" class="control">
                  <el-button @click="cancel">取 消</el-button>
                  <el-button type="primary" @click="submitForm">确 定</el-button>
                </div>
              </div>
            </el-form>

          </div>
        </el-col>
      </el-row>
      <el-dialog
        title="添加食材"
        :visible.sync="dialogVisible"
        width="60%"
        :before-close="handleClose">
        <div class="add-ingredients">
          <div class="add-search">
            <el-input
                placeholder="请输入食材"
                prefix-icon="el-icon-search"
                v-model="ingredientName"
                @input="searchIngredient()">
            </el-input>
          </div>
          <el-row>
            <el-col :span="7">
              <div class="grid-content bg-purple" :style="'height:'+boxheight">
                <div class="above firstAbove"><div class="title">食材分类</div></div>
                <div class="under first_under">
                  <ul>
                    <li v-for="(dict,index) in dict.type.food_type" @click="changeRecipeSort(dict.value,dict.label)" :class="addActived==dict.value?'chooseStyle':''">
                      {{dict.label}}
                    </li>
                  </ul>
                </div>
              </div>
            </el-col>
            <el-col :span="7" style="padding:0 10px">
              <div class="grid-content bg-purple" :style="'height:'+boxheight">
                <div class="above">
                  <div class="title" style="width: 100%;position: relative;text-align: center;">食材列表
                  </div>
                </div>
                <div class="second_under">
                  <ul>
                    <li v-for="(item,index) in recipeList" >
                      <!-- <div class="left" @click="changeRecipeList(item.foodId,index)" :class="addListactived==index?'chooseStyle':''">
                        {{item.foodName}}
                      </div> -->
                      <div class="left" style="display:flex;" @click="changeRecipeList(item.foodId,index)" >
                        <div style="width:50px;height:50px"><img style="width:100%" :src="item.foodImage" alt=""></div>
                        <div style="display:flex;flex-direction: column;justify-content: space-between;margin-left:10px;width: 80%;" :class="addListactived==index?'chooseStyle':''">
                          <span>{{item.foodName}}</span>
                          <span>{{item.weight/1000}}(kg)</span>
                        </div>
                      </div>
                    </li>
                  </ul>
                </div>
              </div>
            </el-col>
            <el-col :span="3">
             <div style="height:100%;display:flex">
               <i class="el-icon-right"></i>
             </div>
            </el-col>
            <el-col :span="7" style="padding:0 10px">
              <div class="grid-content bg-purple" :style="'height:'+boxheight">
                <div class="above">
                  <div class="title" style="width: 100%;position: relative;text-align: center;">已选择的食材
                  </div>
                </div>
                <div class="second_under">
                  <ul>
                    <li v-for="(item,index) in choiceIngredientList" >
                      <div class="left" style="display:flex;">
                        <div style="width:50px;height:50px"><img style="width:100%" :src="item.foodImage" alt=""></div>
                        <div style="display:flex;flex-direction: column;justify-content: space-between;margin-left:10px">
                          <span>{{item.foodName}}</span>
                          <span>{{item.weight/1000}}(kg)</span>
                        </div>
                      </div>
                      <div  class="right" @click="delRecipeName(item.foodId,index)">
                        删除
                      </div>
                    </li>
                  </ul>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="addIngredientHandle()">确 定</el-button>
        </span>
      </el-dialog>

  </div>
</template>

<script>

import { addlistfood, dellistfood, listfood, updateFood,recipeListfood,selectClassifyList,addIngredient,editIngredient,cuisineList } from '@/api/base/grow'

export default {
  name: "Ingredients",
  dicts: ['food_type','cuisine_type'],
  data() {
    return {
      boxheight:0,
      unheight:0,
      actived:null,//分类激活
      listactived:null,//列表激活
      foodList:[],
      cuisineName:'',
      recipeList:[],
      form:{},
      rules:{
        foodName: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        parentId: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        foodId: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        foodImage:[
          {
            required: true, message: "不能为空", trigger: "blur"
          }
        ]
      },
      open:false,//是否添加窗口
      formopen:false,//是否显示右侧详细信息
      tableData: [],
      dialogVisible:false,
      highlightBd: true,
      selectedType: null,
      transferData: [],
      ingredientName:'',
      addActived:null,//新增食材分类激活
      addListactived:null,//新增食材列表激活
      choiceIngredientList:[],
      majorNutrientShow: false
    };
  },
  created() {
  },
  mounted() {
    //获取屏幕高度
    let that=this
    that.boxheight = document.documentElement.clientHeight - 164 + "px;";
    that.unheight=document.documentElement.clientHeight - 340 + "px;";
    window.onresize = function temp() {
      that.boxheight = document.documentElement.clientHeight - 164 + "px;";
      that.unheight=document.documentElement.clientHeight - 340 + "px;";
    };
  },
  computed: {
    formattedEnergy: {
      get() {
        return this.toFixed2(this.form.energy);
      },
      // 如果不需要双向绑定，set 方法可以省略
    },
    formattedFat: {
      get() {
        return this.toFixed2(this.form.fat);
      },
    },
    formattedProtein: {
      get() {
        return this.toFixed2(this.form.protein);
      },
    },
    formattedFatFiber: {
      get() {
        return this.toFixed2(this.form.fatFiber);
      },
    },
    formattedCarbohydrate: {
      get() {
        return this.toFixed2(this.form.carbohydrate);
      },
    },
    formattedVitaminA: {
      get() {
        return this.toFixed2(this.form.vitaminA);
      },
    },
    formattedCarotene: {
      get() {
        return this.toFixed2(this.form.carotene);
      },
    },
    formattedVitaminB1: {
      get() {
        return this.toFixed2(this.form.vitaminB1);
      },
    },
    formattedVitaminB2: {
      get() {
        return this.toFixed2(this.form.vitaminB2);
      },
    },
    formattedVitaminB3: {
      get() {
        return this.toFixed2(this.form.vitaminB3);
      },
    },
    formattedVitaminC: {
      get() {
        return this.toFixed2(this.form.vitaminC);
      },
    },
    formattedVitaminE: {
      get() {
        return this.toFixed2(this.form.vitaminE);
      },
    },
    formattedCa: {
      get() {
        return this.toFixed2(this.form.ca);
      },
    },
    formattedMg: {
      get() {
        return this.toFixed2(this.form.mg);
      },
    },
    formattedFe: {
      get() {
        return this.toFixed2(this.form.fe);
      },
    },
    formattedZn: {
      get() {
        return this.toFixed2(this.form.zn);
      },
    },
    formattedSe: {
      get() {
        return this.toFixed2(this.form.se);
      },
    },
    formattedCu: {
      get() {
        return this.toFixed2(this.form.cu);
      },
    },
    formattedMn: {
      get() {
        return this.toFixed2(this.form.mn);
      },
    },
    formattedI: {
      get() {
        return this.toFixed2(this.form.i);
      },
    },
  },
  methods: {
    toFixed2(value) {
      return value?Number(value).toFixed(2):0;
    },
    // 添加食材-确定
    addIngredientHandle(){
      this.dialogVisible = false
      this.choiceIngredientList.forEach(item => {
      // 检查 tableData 中是否已存在该元素
      const existingItem = this.tableData.find(existingItem => existingItem.foodId === item.foodId);
        if (!existingItem) {
          // 如果不存在，则创建新对象并推入 tableData
          let newItem = {
            name: item.foodName,
            ...item
          };
          this.tableData.push(newItem);
        }
      });
    },
    searchIngredient(){
      this.addActived= null
      this.addListactived = null
      this.getAddList()
    },
    handleClose() {
      this.dialogVisible = false;
    },
     // 增加一行
    addRow() {
      this.dialogVisible = true
      this.choiceIngredientList = []
      // const row = {
      //   foodName: "",
      //   parentId: null,
      //   weight:null
      // };
      // this.tableData.push(row);
    },
    // 删除指定行
    delRow(index) {
      this.tableData.splice(index, 1);
    },
    // 指定位置插入行
    addRowIndex(index) {
      const row = {
        foodName: "",
        parentId: null,
        weight:null
      };
      this.tableData.splice(index + 1, 0, row);
    },
    /**点击食材分类*/
    changefoodSort(value,name){
      this.actived = value
      //调用食材列表接口
      this.getList()

    },
    // 新增食材点击食材分类
    changeRecipeSort(value,name){
      this.ingredientName = ''
      this.addActived= value
      //调用食材列表接口
      this.getAddList()
    },
    async getAddList(){
      try {
        let params = {
          parentId: this.addActived,
          foodName: this.ingredientName
        }
        const {data}=await listfood(params)
        this.recipeList = data
        this.recipeList.forEach(item=>{
          if (item.foodImage && item.foodImage.startsWith("images/")) {
            item.foodImage = window.config.base_url+'/' + item.foodImage;
          }
        })
      }catch (e) {
        console.log(e)
      }
    },
    // 食材列表搜索
    async getCuisineList(){
      const params = {
        name:this.cuisineName
      }
     const res = await cuisineList(params)
     if(res.code == 200){
      this.foodList= res.data
     }
    },
    /**食材列表*/
    async getList(){
      try {
        let params={
          classify:this.actived
        }
        const {data}=await recipeListfood(params)
        this.foodList=data
      }catch (e) {
        console.log(e)
      }
    },
    /**点击食材列表*/
    changefoodList(foodId,index,item){
      this.listactived=index
      this.formopen = true
      this.open = false
      this.majorNutrientShow = true
      console.log('item',item);
      this.ingredientId = item.id
      this.getSelectClassifyList(item.cuisineId)
    },
    // 点击食谱列表获取食材信息
    async getSelectClassifyList(foodId){
      try {
        let params={
          id:foodId
        }
        const {data}=await selectClassifyList(params)
        this.form = data
        this.tableData = data.materialList
      }catch (e) {
        console.log(e)
      }
    },
    // 新增食材-点击食材列表
    changeRecipeList(foodId,index){
      this.ingredientName = ''
      this.addListactived=index
      let chooseFood = this.recipeList.find(item => item.foodId === foodId);
      // 检查食物是否已存在于 choiceIngredientList 中
      let isFoodAlreadyChosen = this.choiceIngredientList.some(
        ingredient => ingredient.foodId === chooseFood.foodId
      );

      if (!isFoodAlreadyChosen) {
        this.choiceIngredientList.push(chooseFood);
        this.choiceIngredientList.forEach(item=>{
          if (item.foodImage && item.foodImage.startsWith("images/")) {
            item.foodImage = window.config.base_url+'/' + item.foodImage;
          }
        })
      }
    },
    /**删除食材列表**/
    async delfoodname(foodId){
      try {
        const data=await dellistfood(foodId)
        if(data.code==200){
          this.msgSuccess("删除成功");
          this.getList()
        }else{
          this.msgSuccess(data.msg);
        }
      }catch (e) {
        console.log(e)
      }
    },
    // 删除新增食谱库食材列表
    delRecipeName(foodId,index){
      this.choiceIngredientList.splice(index, 1);
    },
    /**新增*/
    handleAdd(){
      this.reset();
      this.formopen=true
      this.open=true
    },
    /**新增*/
    submitForm(){
      this.openLoading();
      this.$refs["form"].validate(valid=>{
        if(valid){
          if(!this.open){
            this.form.materialList = []
            this.tableData.forEach((item)=>{
              let newArr = {
                foodId: item.foodId,
                name: item.name,
                phr: item.phr,
                cuisineId:this.form.id
              }
              console.log('newArr',newArr);
              this.form.materialList.push(newArr)
            })
            let params = {
              id:this.ingredientId,
              foodImage:this.form.foodImage,
              name:this.form.name,
              classify: this.form.classify,
              materialList: this.form.materialList,
              schoolCode:this.$store.getters.schoolCode,
              cuisineId:this.form.id
            }
            editIngredient(params).then(res=>{
              if(res.code==200){
                this.msgSuccess("修改成功");
                this.getList()
                this.getSelectClassifyList(this.form.id)
              }else{
                this.msgSuccess(res.msg);
              }
            })
          }else {
            this.form.materialList = []
            this.tableData.forEach((item)=>{
              let newArr = {
                id: item.foodId,
                name: item.name,
                phr: item.phr
              }
              this.form.materialList.push(newArr)
            })
            let params = {
              foodImage:this.form.foodImage,
              name:this.form.name,
              classify: this.form.classify,
              materialList: this.form.materialList
            }
            addIngredient(params).then(res=>{
              if(res.code==200){
                this.msgSuccess("新增成功");
                this.getList()
                this.majorNutrientShow = true
                this.getSelectClassifyList(this.form.classify)
              }else{
                this.msgSuccess(res.msg);
              }
            })
          }

        }
        this.loading.close();
      })
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        foodName: null,
        type: 1,
        parentId: null,
        weight: null,
        foodImage:null,
        energy: null,
        fat: null,
        protein: null,
        fatFiber: null,
        carbohydrate: null,
        vitaminA: null,
        carotene: null,
        vitaminB1: null,
        vitaminB2: null,
        vitaminB3: null,
        vitaminC: null,
        vitaminE: null,
        ca: null,
        mg: null,
        fe: null,
        zn: null,
        se: null,
        cu: null,
        mn: null,
        i: null,
      };
      this.tableData = []
      this.resetForm("form");
    },
    /**关闭*/
    cancel(){
      this.open = false;
      this.formopen=false
      this.reset();
    },
    // 打开加载层
    openLoading() {
      this.loading = this.$loading({
        lock: true,
        text: "拼命读取中",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
    },
  }
};
</script>

<style lang="scss" scoped>
::v-deep .el-upload__tip{
  display: none;
}
ol, ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.app-container{
  .grid-content{
    border: 1px solid #ccc;
    border-radius: 5px;
    .above,.third_above{
      border-bottom: 1px solid #ccc;
      font-weight: 700;
      font-style: normal;
      font-size: 18px;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      justify-content: center;
      height: 17%;
      .title{
        margin: 20px 0;
      }
    }
    .first_under,.second_under{
      height: 83%;
      overflow: auto;
    }

    .under ul{
      padding: 10px;
      overflow: auto;
      li{
        font-size: 14px;
        padding: 12px 0;
        cursor: pointer;
      }
      .chooseStyle{
        color: #fff;
        background-color: #f60;
      }
    }
    .second_under ul{
      padding: 10px;
      li{
        font-size: 14px;
        cursor: pointer;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        .left{
          width: 100%;
          padding: 12px 0;
          padding-left: 10px;
        }
        .right{
          width: 30%;
          padding: 12px 0;
          text-align: center;
          color: #f60;
        }
      }
      .chooseStyle{
        color: #fff;
        background-color: #f60;
      }
    }
    .third_above{
      min-height: 120px;
      border-bottom: 1px solid #ccc;
      .special_Input{
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        padding: 0 10px;
      }
    }
    .third_under{
      padding: 20px;
      overflow: auto;
      .one_part{
        .head{
          font-size: 16px;
          margin-bottom: 15px;
        }
        .info{
          display: flex;
          flex-wrap: wrap;
          .each{
            width: 50%;
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            .foot{
              font-size: 14px;
              color: #606266;
              height: 40px;
              line-height: 40px;
              width: 108px;
            }
          }
        }
      }
      .control{
        text-align: right;
      }
    }
    .add-ingredient{
      position: absolute;
      right: 20px;
      bottom: 0;
      top: 0;
      margin: auto;
    }
    .third_center_table{
      padding: 20px;
      border-bottom: 1px solid #ccc;
      .head{
        padding-bottom: 20px;
      }
    }

  }
}
.add-ingredients{
  width: 100%;
  .add-search{
    margin-bottom: 10px;
  }
}
::v-deep .el-checkbox__input.is-checked + .el-checkbox__label{
  color: #606266!important;
}
::v-deep .el-checkbox__input.is-checked + .el-checkbox__label:hover{
  color: #606266!important;
}
::v-deep .el-transfer-panel{
  width: 300px;
}
::v-deep .el-checkbox.el-transfer-panel__item{
  width: 80%;
}
::v-deep .el-transfer-panel__body{
  height: 80%;
}
::v-deep .el-transfer-panel__list.is-filterable{
  height: 100%;
}
::v-deep .el-transfer-panel__item{
  padding:0 10px;
  height: 60px;
  display: flex !important;
  align-items: center;
  .el-checkbox__input{
    position: relative;
    top: 0px;
  }
}
::v-deep .el-transfer__buttons{
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid #e6ebf5;
    border-bottom: 1px solid #e6ebf5;
}
::v-deep .el-transfer__button:first-child{
  margin-bottom:0px
}
::v-deep .el-dialog__footer{
  text-align: center;
}
// 修改高亮背景色和color
::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
  background-color: #8cc8ff;
  color: #fff;
}
</style>

